package org.chs.ts.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.chs.ts.vo.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import org.willa.system.entity.vo.SysUserVO;
import org.willa.system.service.ILoginService;

import javax.annotation.Resource;

/**
 * @author wuwei
 * @date 2024/1/2
 * @apiNote
 */
@RequestMapping("/login")
@RestController
@Api(tags = "登录相关功能")
public class LoginController {
    @Resource
    private ILoginService loginService;

    @ApiOperation("用户登录")
    @ApiImplicitParam(name="sysUser",value ="登录用户对象",required = true)
    @PostMapping("/check")
    public Result login(@RequestBody SysUserVO sysUser){
        return loginService.login(sysUser);
    }

    @PostMapping("/logout")
    @ApiOperation("用户登出")
    public Result logout()
    {
        return loginService.logout();
    }
}
